
import signal
import sys
import time
import serialer
import serial
import window
from PyQt5.QtWidgets import QApplication,QMainWindow
import pyqtgraph as pg
import numpy as np
import ui_custom

# 强制退出
def handle_signal(signum, frame):
    print("$$$ (ctrl + c) press and exit $$$")
    sys.exit(0)

signal.signal(signal.SIGINT, handle_signal)

global ser # 串口实例
global ui # ui界面实例

if __name__ == '__main__':
    # 串口处理
    ser = serial.Serial('COM10', 115200, timeout=1)
    serialer.creat_task(ser)

    # 界面处理
    app = QApplication(sys.argv)
    app.setStyle("CDE")
    MainWindow = QMainWindow()
    ui = window.Ui_MainWindow()

    ui.setupUi(MainWindow)
    ui_custom.ui_custom_setup(ui)
    ui_custom.creat_ui_custom_task(ui)

    MainWindow.show()
    sys.exit(app.exec_())
